package com.supermarket.file.service;

import com.supermarket.file.utils.OssUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class AlibabaOssFileServiceImpl implements OssFileService{
    @Autowired
    private OssUtils ossUtils;
    @Override
    public String ossUploadFile(MultipartFile file) throws Exception {
        try {
            String multipartFile = ossUtils.uploadMultipartFile(file);
            System.out.println("图片路径为{}"+multipartFile);
            return multipartFile;
        } catch (Exception e) {
            throw new Exception("阿里云Oss上传失败");
        }
    }
}
